home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
XDUP.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
2KB
|
57 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_XDup( cOutFile, lKeep ) --> nRecsDeleted
PARAMETERS:
cOutFile : Optional - Output file to contain duplicate records
lKeep : Keep First/Last occurance. TRUE = First (default) FALSE = Last
SHORT:
Delete duplicate records in a database based upon index key.
DESCRIPTION:
_XDup() will check the file in the CURRENT WORKAREA for duplicate records
ACCORDING TO THE FILE'S CURRENT INDEX KEY. When duplicates are found, if
cOutFile is not specified, the duplicate records are deleted. If cOutFile is
specified, duplicate records are deleted after being copied to the file named
in cOutFile.
If lKeep = TRUE, the FIRST record from a group of duplicate records is kept,
the rest are deleted/copied. If FALSE, then the LAST record from a group of
duplicates is kept/copied.
_XDup() returns the number of duplicate records deleted. If no index is
currently open, the function immediately returns -1.
The file being checked must be open in EXCLUSIVE mode.
NOTE:
This is not a thouroughly tested function. Use caution.
EXAMPLE:
USE file.dbf
SET INDEX TO file.ntx // keyed on LastName+FirstName
_XDup()
Result: No parameters were passed, so the defaults of No Copy File and
Keep First apply. All duplicate records are simply deleted and the
FIRST occurance of each duplicate is kept.
_XDup('TEMP.DBF',FALSE)
Result: Duplicate records are copied to TEMP.DBF before being deleted.
The LAST record in each group of duplicates is kept.
******************************************************************************/